#Lindsay Ergenekan
#ergenekl@onid.oregonstate.edu
#CS311-400
#Homework2- Question4


import sets, getopt, sys, os, numbers

def main(argv): 
   if (str.isdigit(sys.argv[1])):
      prime_wanted = sys.argv[1]
      print "We are looking for the " + prime_wanted + "th prime number"  
      generatePrimes(prime_wanted)

def isPrime(num): 
   if num == 2: 
      return True
   elif (num < 2 or not num % 2): 
      return False 

   for i in range(3, int(num **.5 +1), 2): 
      if not num %i: 
         return False 
      return True

def generatePrimes(prime_wanted): 
   primes = [2, ]
   numPrimes = 1
   testNum = 3 
   
   print numPrimes
   print prime_wanted

   while numPrimes < prime_wanted: 
      if isPrime(testNum): 
         print "num Primes: " 
         print numPrimes
         print " " 
         primes.append(testNum)
         numPrimes += 1
      testNum += 2

   return primes






if __name__ == "__main__":
   main(sys.argv[1:])
